import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-10-25
 * Time: 16:13
 */
public class Demo3 {
    public static void main(String[] args) throws IOException{
        try (Reader reader = new FileReader("d:/test.txt")) {
            while (true) {
                char[] buf = new char[20480];
                int n = reader.read(buf);
                System.out.println("读到的字符个数为： " + n);
                if( n == -1) {
                    break;
                }
                for (int i = 0; i < n; i++) {
                    System.out.print(buf[i]);
                }
            }
        }
    }
}